<!DOCTYPE html>

<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title></title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="">
    </head>
    <body>
      
        <script>
      
//基本用法

let[x,y]= [I, 2];

console.log(x, y); //1,2

//剩余运算符

let a, b, rest;

[a, b,...rest] =[1,2,3, 4, 5, 6];

console.log(a, b, rest); //rest [3,4,5,6]

// 可忽略

let[a,b]=[1,2, 3];

console.log(a, b);

//不完全解构

let[a, b] = [1];

console.log(a, b);

//解构默认值

let[a, b=2]= [l];

console. log(a, b);

//对字符串进行解构赋值

let[a, b,c,d, e] = "hello";

console.log(a, b, C, d, e);

        </script>
    </body>
</html>